package com.hand.wyc24548.infra.repository.impl;

import java.util.List;

import org.hzero.mybatis.base.impl.BaseRepositoryImpl;
import org.hzero.mybatis.common.Criteria;
import org.springframework.stereotype.Component;

import com.hand.wyc24548.domain.entity.SoLine;
import com.hand.wyc24548.domain.repository.SoLineRepository;
import com.hand.wyc24548.infra.mapper.SoLineMapper;

/**
 * @Author wangyc
 * @create 2019/8/9 15:03
 */

@Component
public class SoLineRepositoryImpl extends BaseRepositoryImpl<SoLine> implements SoLineRepository {

    private final SoLineMapper soLineMapper;

    public SoLineRepositoryImpl(SoLineMapper soLineMapper) {
        this.soLineMapper = soLineMapper;
    }

    @Override
    public List<SoLine> selectBySoHeaderId(Long soHeaderId) {
        SoLine soLine=new SoLine();
        soLine.setSoHeaderId(soHeaderId);
        return this.selectOptional(soLine,new Criteria()
                .select(SoLine.FIELD_so_line_id,SoLine.FIELD_SOHEADERID,SoLine.FIELD_SOLINENUMBER,SoLine.FIELD_ITEMID
                ,SoLine.FIELD_ORDERQUANTITY,SoLine.FIELD_ORDERQUANTITYUOM,SoLine.FIELD_UNITSELLINGPRICE,SoLine.FIELD_DESCRIPTION)
                .where(SoLine.FIELD_SOHEADERID)
        );
    }
}
